/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.obeonetwork.dsl.spem.extension.spem_ifest.provider;

import java.util.ArrayList;
import java.util.Collection;

import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.Notifier;

import org.eclipse.emf.edit.provider.ChangeNotifier;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.provider.IChangeNotifier;
import org.eclipse.emf.edit.provider.IDisposable;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.INotifyChangedListener;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;

import org.obeonetwork.dsl.spem.extension.spem_ifest.util.Spem_ifestAdapterFactory;

/**
 * This is the factory that is used to provide the interfaces needed to support Viewers.
 * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}.
 * The adapters also support Eclipse property sheets.
 * Note that most of the adapters are shared among multiple instances.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public class Spem_ifestItemProviderAdapterFactory extends Spem_ifestAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable {
	/**
	 * This keeps track of the root adapter factory that delegates to this adapter factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ComposedAdapterFactory parentAdapterFactory;

	/**
	 * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected IChangeNotifier changeNotifier = new ChangeNotifier();

	/**
	 * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected Collection<Object> supportedTypes = new ArrayList<Object>();

	/**
	 * This constructs an instance.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Spem_ifestItemProviderAdapterFactory() {
		supportedTypes.add(IEditingDomainItemProvider.class);
		supportedTypes.add(IStructuredItemContentProvider.class);
		supportedTypes.add(ITreeItemContentProvider.class);
		supportedTypes.add(IItemLabelProvider.class);
		supportedTypes.add(IItemPropertySource.class);
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.obeonetwork.dsl.spem.extension.spem_ifest.EngineeringDomain} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EngineeringDomainItemProvider engineeringDomainItemProvider;

	/**
	 * This creates an adapter for a {@link org.obeonetwork.dsl.spem.extension.spem_ifest.EngineeringDomain}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createEngineeringDomainAdapter() {
		if (engineeringDomainItemProvider == null) {
			engineeringDomainItemProvider = new EngineeringDomainItemProvider(this);
		}

		return engineeringDomainItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.obeonetwork.dsl.spem.extension.spem_ifest.ToolDefinition} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ToolDefinitionItemProvider toolDefinitionItemProvider;

	/**
	 * This creates an adapter for a {@link org.obeonetwork.dsl.spem.extension.spem_ifest.ToolDefinition}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createToolDefinitionAdapter() {
		if (toolDefinitionItemProvider == null) {
			toolDefinitionItemProvider = new ToolDefinitionItemProvider(this);
		}

		return toolDefinitionItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.obeonetwork.dsl.spem.extension.spem_ifest.Viewpoint} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ViewpointItemProvider viewpointItemProvider;

	/**
	 * This creates an adapter for a {@link org.obeonetwork.dsl.spem.extension.spem_ifest.Viewpoint}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createViewpointAdapter() {
		if (viewpointItemProvider == null) {
			viewpointItemProvider = new ViewpointItemProvider(this);
		}

		return viewpointItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.obeonetwork.dsl.spem.extension.spem_ifest.TaskDefinition} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected TaskDefinitionItemProvider taskDefinitionItemProvider;

	/**
	 * This creates an adapter for a {@link org.obeonetwork.dsl.spem.extension.spem_ifest.TaskDefinition}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createTaskDefinitionAdapter() {
		if (taskDefinitionItemProvider == null) {
			taskDefinitionItemProvider = new TaskDefinitionItemProvider(this);
		}

		return taskDefinitionItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.obeonetwork.dsl.spem.extension.spem_ifest.ArtifactDefinition} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ArtifactDefinitionItemProvider artifactDefinitionItemProvider;

	/**
	 * This creates an adapter for a {@link org.obeonetwork.dsl.spem.extension.spem_ifest.ArtifactDefinition}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createArtifactDefinitionAdapter() {
		if (artifactDefinitionItemProvider == null) {
			artifactDefinitionItemProvider = new ArtifactDefinitionItemProvider(this);
		}

		return artifactDefinitionItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.obeonetwork.dsl.spem.extension.spem_ifest.SPEM_IFEST} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected SPEM_IFESTItemProvider speM_IFESTItemProvider;

	/**
	 * This creates an adapter for a {@link org.obeonetwork.dsl.spem.extension.spem_ifest.SPEM_IFEST}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createSPEM_IFESTAdapter() {
		if (speM_IFESTItemProvider == null) {
			speM_IFESTItemProvider = new SPEM_IFESTItemProvider(this);
		}

		return speM_IFESTItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.obeonetwork.dsl.spem.extension.spem_ifest.ToolType} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ToolTypeItemProvider toolTypeItemProvider;

	/**
	 * This creates an adapter for a {@link org.obeonetwork.dsl.spem.extension.spem_ifest.ToolType}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createToolTypeAdapter() {
		if (toolTypeItemProvider == null) {
			toolTypeItemProvider = new ToolTypeItemProvider(this);
		}

		return toolTypeItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.obeonetwork.dsl.spem.extension.spem_ifest.EngineeringDomainPackage} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EngineeringDomainPackageItemProvider engineeringDomainPackageItemProvider;

	/**
	 * This creates an adapter for a {@link org.obeonetwork.dsl.spem.extension.spem_ifest.EngineeringDomainPackage}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createEngineeringDomainPackageAdapter() {
		if (engineeringDomainPackageItemProvider == null) {
			engineeringDomainPackageItemProvider = new EngineeringDomainPackageItemProvider(this);
		}

		return engineeringDomainPackageItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.obeonetwork.dsl.spem.extension.spem_ifest.ToolTypePackage} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ToolTypePackageItemProvider toolTypePackageItemProvider;

	/**
	 * This creates an adapter for a {@link org.obeonetwork.dsl.spem.extension.spem_ifest.ToolTypePackage}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createToolTypePackageAdapter() {
		if (toolTypePackageItemProvider == null) {
			toolTypePackageItemProvider = new ToolTypePackageItemProvider(this);
		}

		return toolTypePackageItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.obeonetwork.dsl.spem.extension.spem_ifest.MetaModel} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected MetaModelItemProvider metaModelItemProvider;

	/**
	 * This creates an adapter for a {@link org.obeonetwork.dsl.spem.extension.spem_ifest.MetaModel}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createMetaModelAdapter() {
		if (metaModelItemProvider == null) {
			metaModelItemProvider = new MetaModelItemProvider(this);
		}

		return metaModelItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.obeonetwork.dsl.spem.extension.spem_ifest.MetaModelPackage} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected MetaModelPackageItemProvider metaModelPackageItemProvider;

	/**
	 * This creates an adapter for a {@link org.obeonetwork.dsl.spem.extension.spem_ifest.MetaModelPackage}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createMetaModelPackageAdapter() {
		if (metaModelPackageItemProvider == null) {
			metaModelPackageItemProvider = new MetaModelPackageItemProvider(this);
		}

		return metaModelPackageItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.obeonetwork.dsl.spem.extension.spem_ifest.OntologyLinkedElement} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected OntologyLinkedElementItemProvider ontologyLinkedElementItemProvider;

	/**
	 * This creates an adapter for a {@link org.obeonetwork.dsl.spem.extension.spem_ifest.OntologyLinkedElement}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createOntologyLinkedElementAdapter() {
		if (ontologyLinkedElementItemProvider == null) {
			ontologyLinkedElementItemProvider = new OntologyLinkedElementItemProvider(this);
		}

		return ontologyLinkedElementItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.obeonetwork.dsl.spem.extension.spem_ifest.ArtifactDefinitionPackage} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ArtifactDefinitionPackageItemProvider artifactDefinitionPackageItemProvider;

	/**
	 * This creates an adapter for a {@link org.obeonetwork.dsl.spem.extension.spem_ifest.ArtifactDefinitionPackage}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createArtifactDefinitionPackageAdapter() {
		if (artifactDefinitionPackageItemProvider == null) {
			artifactDefinitionPackageItemProvider = new ArtifactDefinitionPackageItemProvider(this);
		}

		return artifactDefinitionPackageItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.obeonetwork.dsl.spem.extension.spem_ifest.Artifact} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ArtifactItemProvider artifactItemProvider;

	/**
	 * This creates an adapter for a {@link org.obeonetwork.dsl.spem.extension.spem_ifest.Artifact}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createArtifactAdapter() {
		if (artifactItemProvider == null) {
			artifactItemProvider = new ArtifactItemProvider(this);
		}

		return artifactItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.obeonetwork.dsl.spem.extension.spem_ifest.Activity} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ActivityItemProvider activityItemProvider;

	/**
	 * This creates an adapter for a {@link org.obeonetwork.dsl.spem.extension.spem_ifest.Activity}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createActivityAdapter() {
		if (activityItemProvider == null) {
			activityItemProvider = new ActivityItemProvider(this);
		}

		return activityItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.obeonetwork.dsl.spem.extension.spem_ifest.ArtifactTransformation} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ArtifactTransformationItemProvider artifactTransformationItemProvider;

	/**
	 * This creates an adapter for a {@link org.obeonetwork.dsl.spem.extension.spem_ifest.ArtifactTransformation}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createArtifactTransformationAdapter() {
		if (artifactTransformationItemProvider == null) {
			artifactTransformationItemProvider = new ArtifactTransformationItemProvider(this);
		}

		return artifactTransformationItemProvider;
	}

	/**
	 * This returns the root adapter factory that contains this factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ComposeableAdapterFactory getRootAdapterFactory() {
		return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory();
	}

	/**
	 * This sets the composed adapter factory that contains this factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
		this.parentAdapterFactory = parentAdapterFactory;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean isFactoryForType(Object type) {
		return supportedTypes.contains(type) || super.isFactoryForType(type);
	}

	/**
	 * This implementation substitutes the factory itself as the key for the adapter.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter adapt(Notifier notifier, Object type) {
		return super.adapt(notifier, this);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object adapt(Object object, Object type) {
		if (isFactoryForType(type)) {
			Object adapter = super.adapt(object, type);
			if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) {
				return adapter;
			}
		}

		return null;
	}

	/**
	 * This adds a listener.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void addListener(INotifyChangedListener notifyChangedListener) {
		changeNotifier.addListener(notifyChangedListener);
	}

	/**
	 * This removes a listener.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void removeListener(INotifyChangedListener notifyChangedListener) {
		changeNotifier.removeListener(notifyChangedListener);
	}

	/**
	 * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void fireNotifyChanged(Notification notification) {
		changeNotifier.fireNotifyChanged(notification);

		if (parentAdapterFactory != null) {
			parentAdapterFactory.fireNotifyChanged(notification);
		}
	}

	/**
	 * This disposes all of the item providers created by this factory. 
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void dispose() {
		if (engineeringDomainItemProvider != null) engineeringDomainItemProvider.dispose();
		if (toolDefinitionItemProvider != null) toolDefinitionItemProvider.dispose();
		if (viewpointItemProvider != null) viewpointItemProvider.dispose();
		if (taskDefinitionItemProvider != null) taskDefinitionItemProvider.dispose();
		if (artifactDefinitionItemProvider != null) artifactDefinitionItemProvider.dispose();
		if (speM_IFESTItemProvider != null) speM_IFESTItemProvider.dispose();
		if (toolTypeItemProvider != null) toolTypeItemProvider.dispose();
		if (engineeringDomainPackageItemProvider != null) engineeringDomainPackageItemProvider.dispose();
		if (toolTypePackageItemProvider != null) toolTypePackageItemProvider.dispose();
		if (metaModelItemProvider != null) metaModelItemProvider.dispose();
		if (metaModelPackageItemProvider != null) metaModelPackageItemProvider.dispose();
		if (ontologyLinkedElementItemProvider != null) ontologyLinkedElementItemProvider.dispose();
		if (artifactDefinitionPackageItemProvider != null) artifactDefinitionPackageItemProvider.dispose();
		if (artifactItemProvider != null) artifactItemProvider.dispose();
		if (activityItemProvider != null) activityItemProvider.dispose();
		if (artifactTransformationItemProvider != null) artifactTransformationItemProvider.dispose();
	}

}
